package net.wds.ssbus.modules.dbconfig.controller;

import java.util.Arrays;
import java.util.Map;

import net.wds.ssbus.common.utils.PageUtils;
import net.wds.ssbus.common.utils.R;
import net.wds.ssbus.modules.dbconfig.entity.TbDbModelColumnEntity;
import net.wds.ssbus.modules.dbconfig.service.TbDbModelColumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 模型字段 
 *
 * @author qsg
 * @email qsg@wdsrouce
 * @date 2020-10-22 11:41:56
 */
@RestController
@RequestMapping("dbconfig/tbdbmodelcolumn")
public class TbDbModelColumnController {
    @Autowired
    private TbDbModelColumnService tbDbModelColumnService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ssbus:tbdbmodelcolumn:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbDbModelColumnService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("ssbus:tbdbmodelcolumn:info")
    public R info(@PathVariable("id") Integer id){
		TbDbModelColumnEntity tbDbModelColumn = tbDbModelColumnService.getById(id);

        return R.ok().put("tbDbModelColumn", tbDbModelColumn);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ssbus:tbdbmodelcolumn:save")
    public R save(@RequestBody TbDbModelColumnEntity tbDbModelColumn){
		tbDbModelColumnService.save(tbDbModelColumn);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ssbus:tbdbmodelcolumn:update")
    public R update(@RequestBody TbDbModelColumnEntity tbDbModelColumn){
		tbDbModelColumnService.updateById(tbDbModelColumn);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ssbus:tbdbmodelcolumn:delete")
    public R delete(@RequestBody Integer[] ids){
		tbDbModelColumnService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
